package com.wxtwxt.ruralmall.order.web;

import com.wxtwxt.ruralmall.order.service.OrderService;
import com.wxtwxt.ruralmall.order.vo.OrderConfirmVo;
import com.wxtwxt.ruralmall.order.vo.OrderSubmitVo;
import com.wxtwxt.ruralmall.order.vo.SubmitOrderResponseVo;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import javax.annotation.Resource;

/**
 * @author Wxt
 * @create 2023-04-26 21:51
 */
@Controller
public class OrderWebController {

    @Resource
    private OrderService orderService;

    @GetMapping("/toTrade")
    public String toTrade(Model model) {
        OrderConfirmVo orderConfirmVo = orderService.getOrderConfirmVo();
        model.addAttribute("orderConfirmVo", orderConfirmVo);
        return "confirm";
    }

//    @PostMapping("/submitOrder")
//    public String submitOrder(OrderSubmitVo orderSubmitVo) {
//        SubmitOrderResponseVo submitOrderResponseVo = orderService.submitOrder(orderSubmitVo);
//        if(submitOrderResponseVo.getCode() == 0) {
//            return "pay";
//        }else {
//            return "redirect:http://order.gulimall.com/toTrade";
//        }
//    }
}
